const invertTree = function (root) {
  if (!root) return root

  [root.left,root.right] = [invertTree(root.right),invertTree(root.left)]
  return root
}